package com.k.base.jdk.proxy.demo2.frm;

import java.lang.reflect.Method;

/**

正常情况
 @Around start
 @Before…
 method invoke
 @Around end
 @After…
 @AfterReturning…

 有异常的情况
 @Around start
 @Before…
 method invoke
 @After…
 @AfterThrowing…

 整个执行过程：
 try{
     try{
         //@Around start
         //@Before
         method.invoke(..);
         //@Around end
     }finally{
        //@After
     }
    //@AfterReturning
 }catch(){
    //@AfterThrowing
 }

 */
public interface ProxyAction {
    /**
     * before always
     */
    void before(Object proxy, Method method, Object[] args);

    /**
     * success - after if after not exception
     */
    void after(Object proxy, Method method, Object[] args,Object result);

    /**
     * error - exception if exception not after
     */
    void exception(Object proxy, Method method, Object[] args);

    /**
     * afterReturn always
     */
    void afterReturn(Object proxy, Method method, Object[] args,Object result);
}
